package com.weiyuwqj.server.service.verify.impl;

import com.weiyuwqj.api.model.BusVerifyLog;
import com.weiyuwqj.api.service.BusVerifyLogService;
import com.weiyuwqj.server.mapper.BusVerifyLogMapper;
import com.weiyuwqj.server.service.base.BaseServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * Created by pg on 15/12/27.
 */

@Service("verifyLogService")
public class BusVerifyLogServiceImpl extends BaseServiceImpl<BusVerifyLog> implements BusVerifyLogService {

    @Autowired
    private BusVerifyLogMapper busVerifyLogMapper;

    private static final String[] TYPE = {"releaseTime", "firstTime", "fullTime", "complexTime", "stillTime"};

    @Override
    public Map getListByItemId(Integer itemId) {
        List<BusVerifyLog> list=busVerifyLogMapper.getListByItemId(itemId);
        Map<String, Object> map=new HashMap<>();
        for (BusVerifyLog aList : list) {
            if (aList.getType() == 1) {
                map.put("releaseTime", aList.getAddtime()); // 发标
            } else if (aList.getType() == 2) {
                map.put("firstTime", aList.getAddtime());// 初审
            } else if (aList.getType() == 3) {
                map.put("fullTime", aList.getAddtime());// 满标
            } else if (aList.getType() == 4) {
                map.put("complexTime", aList.getAddtime()); // 复审
            } else if (aList.getType() == 5) {
                map.put("stillTime", aList.getAddtime());// 还款
            }
        }
        return map;
    }

}
